<template>
  <div class="header-box">
    <div class="user">
      <div class="imgbox">
        <img src="../../../../../static/images/user.jpg" alt="" />
      </div>
      <div class="name">
        <span>深</span>
      </div>
    </div>
    <div class="btnbox">
      <div>
        <div class="btn zuoyou" @click="prev">
          <i class="iconfont icon-zuoyou"></i>
        </div>
        <div class="btn zuoyou" @click="next">
          <i class="iconfont icon-zuoyou1"></i>
        </div>
      </div>
    </div>
    <div class="search-box">
      <el-input
        placeholder="请输入内容"
        v-model="keyword"
        class="input-with-select"
        style="height:40px"
      >
        <el-button
          slot="append"
          @click="goSearch"
          icon="el-icon-search"
        ></el-button>
      </el-input>
      <div class="drag"></div>
    </div>
    <div class="menu">
      <div>
        <div class="btn">
          <i class="iconfont icon-shezhi2"></i>
        </div>
        <div class="btn" @click="minimize">
          <i class="iconfont icon-zuixiaohua1"></i>
        </div>
        <div class="btn" @click="maximize">
          <i class="iconfont icon-zuidahua1"></i>
        </div>
        <div class="btn" @click="exit">
          <i class="iconfont icon-close"></i>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      keyword: null,
    }
  },
  methods: {
    prev() {
      this.$router.go(-1)
    },
    next() {
      this.$router.go(1)
    },
    exit() {
      this.$electron.ipcRenderer.send("hide")
    },
    maximize() {
      this.$electron.ipcRenderer.send("maximize")
    },
    minimize() {
      this.$electron.ipcRenderer.send("minimize")
    },
    // 搜索
    goSearch() {
      console.log(this.keyword)
      this.$router.push({
        name: "search",
        query: { keyword: this.keyword },
      })
    },
  },
}
</script>
<style lang="scss" scoped>
.header-box {
  height: 60px;
  width: 100%;
  display: flex;
  background: rgb(240, 240, 240);
  .user {
    width: 250px;
    height: 60px;
    display: flex;
    .imgbox {
      width: 60px;
      height: 60px;
      display: flex;
      align-items: center;
      justify-content: center;
      img {
        height: 40px;
        width: 40px;
        border-radius: 5px;
      }
    }
    .name {
      display: flex;
      align-items: center;
      justify-content: start;
      padding-left: 10px;
    }
  }
  .btnbox {
    padding-left: 10px;
    width: 100px;
    display: flex;
    justify-content: start;
    align-items: center;
    div {
      display: flex;
      .zuoyou {
        background: #ffffff;
      }
      .btn {
        height: 30px;
        width: 30px;

        display: flex;
        justify-content: center;
        align-items: center;
      }
      .btn:hover {
        cursor: pointer;
      }
      .btn:nth-child(1) {
        border-right: 1px solid #ccc;
      }
    }
  }
  .search-box {
    flex: auto;
    display: flex;
    justify-content: start;
    align-items: center;
    overflow: hidden;
    /deep/ .el-input__inner {
      height: 30px !important;
    }
    /deep/ .el-input {
      height: 30px !important;
      width: 270px !important;
    }
    .drag {
      width: calc(100% - 270px);
      height: 100%;
      -webkit-app-region: drag;
    }
  }
  .menu {
    width: 130px;
    display: flex;
    justify-content: end;
    align-items: center;
    div {
      display: flex;
      div {
        height: 30px;
        width: 30px;
        display: flex;
        justify-content: center;
        align-items: center;
      }
    }
    .btn:hover {
      cursor: pointer;
    }
    .icon-zuixiaohua1 {
      font-size: 19px;
    }
  }
}
</style>
